package com.ruoyi.project.hr.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.project.hr.domain.THrInfoOutcompany;
import com.ruoyi.project.hr.service.ITHrInfoOutcompanyService;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.framework.web.page.TableDataInfo;

/**
 * 外包公司信息管理Controller
 * 
 * @author lt
 * @date 2020-04-12
 */
@RestController
@RequestMapping("/hr/OUTCOMPANY")
public class THrInfoOutcompanyController extends BaseController
{
    @Autowired
    private ITHrInfoOutcompanyService tHrInfoOutcompanyService;

    /**
     * 查询外包公司信息管理列表
     */
    @PreAuthorize("@ss.hasPermi('hr:OUTCOMPANY:list')")
    @GetMapping("/list")
    public TableDataInfo list(THrInfoOutcompany tHrInfoOutcompany)
    {
        startPage();
        List<THrInfoOutcompany> list = tHrInfoOutcompanyService.selectTHrInfoOutcompanyList(tHrInfoOutcompany);
        return getDataTable(list);
    }

    /**
     * 导出外包公司信息管理列表
     */
    @PreAuthorize("@ss.hasPermi('hr:OUTCOMPANY:export')")
    @Log(title = "外包公司信息管理", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(THrInfoOutcompany tHrInfoOutcompany)
    {
        List<THrInfoOutcompany> list = tHrInfoOutcompanyService.selectTHrInfoOutcompanyList(tHrInfoOutcompany);
        ExcelUtil<THrInfoOutcompany> util = new ExcelUtil<THrInfoOutcompany>(THrInfoOutcompany.class);
        return util.exportExcel(list, "OUTCOMPANY");
    }

    /**
     * 获取外包公司信息管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('hr:OUTCOMPANY:query')")
    @GetMapping(value = "/{operModeName}")
    public AjaxResult getInfo(@PathVariable("operModeName") String operModeName)
    {
        return AjaxResult.success(tHrInfoOutcompanyService.selectTHrInfoOutcompanyById(operModeName));
    }

    /**
     * 新增外包公司信息管理
     */
    @PreAuthorize("@ss.hasPermi('hr:OUTCOMPANY:add')")
    @Log(title = "外包公司信息管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody THrInfoOutcompany tHrInfoOutcompany)
    {
        return toAjax(tHrInfoOutcompanyService.insertTHrInfoOutcompany(tHrInfoOutcompany));
    }

    /**
     * 修改外包公司信息管理
     */
    @PreAuthorize("@ss.hasPermi('hr:OUTCOMPANY:edit')")
    @Log(title = "外包公司信息管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody THrInfoOutcompany tHrInfoOutcompany)
    {
        return toAjax(tHrInfoOutcompanyService.updateTHrInfoOutcompany(tHrInfoOutcompany));
    }

    /**
     * 删除外包公司信息管理
     */
    @PreAuthorize("@ss.hasPermi('hr:OUTCOMPANY:remove')")
    @Log(title = "外包公司信息管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{operModeNames}")
    public AjaxResult remove(@PathVariable String[] operModeNames)
    {
        return toAjax(tHrInfoOutcompanyService.deleteTHrInfoOutcompanyByIds(operModeNames));
    }
}
